<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // const vm = new Promise((res, rej) => {
    //   setTimeout(() => {
    //     rej("NavigationDuplicated: Avoided redundant navigation to current location: '/search'.")
    //   }, 1000)
    // })

    function push(location, onComplete, onAbort) {
      return new Promise((res, rej) => {
          setTimeout(() => {
            rej("NavigationDuplicated: Avoided redundant navigation to current location: '/search'.")
          }, 1000)
        })
        .then(onComplete)
        .catch(onAbort)
    }

    function myPush(a, onComplete = () => {}, onAbort = () => {}) {
      return push(a, onComplete, onAbort)
    }
    myPush("123")
  </script>
</body>

</html>